#ifndef __XPACKET_H__
#define __XPACKET_H__


#ifndef XPACKET_LENGTH
#define XPACKET_LENGTH 50
#endif


typedef struct xpacket_t {
	
	uint8_t type;
	//uint8_t port;
	uint8_t seq;
	//uint8_t len;
	
	uint8_t data[XPACKET_LENGTH];
	
} xpacket_t;


void        XPACKET_init(void);

error_t     XPACKET_send(uint8_t type, message_t* msg, uint8_t len);
void        XPACKET_sendDone(error_t);

message_t*  XPAKCET_receive(message_t*, void*, uint8_t);


/**
 *  PACKET API
 */

void        XPACKET_setType(message_t* msg, uint8_t type);
uint8_t     XPACKET_getType(message_t* msg);

//void        XPACKET_setPort(message_t* msg, uint8_t port);
//uint8_t     XPACKET_getPort(message_t* msg);

void        XPACKET_setSeq(message_t* msg, uint8_t seq);
uint8_t     XPACKET_getSeq(message_t* msg);

void*       XPACKET_getData(message_t* msg);


#endif // __XPACKET_H__